<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        function compu(a, b, c) {
            var sum;
            switch (b) {
                case '+':
                    sum = a + c;
                    break;
                case '-':
                    sum = a - c;
                    break;
                case '*':
                    sum = a * c;
                    break
                case '/':
                    sum = a / c;
                    break
                case '%':
                    sum = a % c;
                    break
            }
            return sum;
        }
        var x = prompt('请输入第一个数字：');
        var y = prompt('请输入第二个数字：');
        var s = prompt('请输入任意算数运算符：');
        alert(compu(parseFloat(x), s, parseFloat(y)))
    </script>
</head>

<body>

</body>

</html>